package com.zang.schema.strategy;

import com.zang.schema.strategy.total.Travel;

/**
 * 执行
 * 策略模式 - 封装策略，通过工厂选择对应策略实现
 *
 * @author Zhang Qiang
 * @Date 2019/8/30 17:06
 */
public class Action {
    public static void main(String[] args) {
        new Action().travel();
    }
    public void travel(){
        StrategyEnum strategyEnum = StrategyEnum.BY_PLANE;
        Travel travel = StrategyFactory.createTravel(strategyEnum);
        travel.travelWay("吞州");

        Travel travelsXml = StrategyFactory.createTravelByXml();
        travelsXml.travelWay("亳州");

        StrategyClassEnum strategyClassEnum = StrategyClassEnum.BY_SELFDRIVER;
        Travel travelNewInstend = StrategyFactory.createTravelByNewInstend(strategyClassEnum);
        travelNewInstend.travelWay("魔都");

    }

}
